﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AddOperation.cs" company="Matthias Friedrich">
//   Copyright © Matthias Friedrich 2013
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Sample2
{
    using System.Collections.Generic;
    using System.Linq;

    using CommandlineHandling;

    internal class AddOperation : Option
    {
        public AddOperation()
        {
            this.Execute = (caller, arg) => this.Add(arg.ParameterList("v"));
        }

        private int Add(IEnumerable<OptionParameter> values)
        {
            return values.Sum(next => (int)next);
        }
    }
}